package com.wudl.input

import java.io.{BufferedWriter, FileOutputStream, OutputStreamWriter}

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}
import java.io._

object TextFile {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local").setAppName("textFile")
    val sc = new SparkContext(conf)
    val lines: RDD[String] = sc.textFile("D:\\tmp\\jison.txt")
    val data = lines.flatMap(line => line.split(",")).map(word => (word, 1)).reduceByKey((v1, v2) => v1 + v2)
    data.foreach(println)

  }

}
